﻿@model EventModel
@{
    ViewBag.Title = "新建活动";
    Layout = "~/Views/Shared/_Layout.cshtml";

    var category = ViewBag.Category as IEnumerable<SelectListItem>;
    var user = ViewBag.User as User;
}

@section Direct{

    @if (user.IsAdministrator())
    {
        <div class="adr">
            <ul>
                @if (Model == null)
                {
                    <li>@Html.ActionLink("返回", "Index", "Event")
                    </li>
                }
                else
                {
                    <li>@Html.ActionLink("返回", "Detail", "Event", new { id = Model.Id }, new { })
                    </li>
                }
                <li>@Html.ActionLink("活动类别管理", "Index", "Category")
                </li>
            </ul>
        </div>
    }
}
<section class="ec-add">
    <div class="form">
        @if (Model == null)
        {
            Html.BeginForm("Add", "Event");
        }
        else
        {
            Html.BeginForm("Edit", "Event");
        }
        <div class="field">
            <div class="editor-label">
                @Html.LabelFor(model => model.Title)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Title)
                @Html.ValidationMessageFor(model => model.Title)
            </div>
        </div>
        <div class="field">
            <div class="editor-label">
                @Html.LabelFor(model => model.Category)
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(model => model.Category, @category)
                @Html.ValidationMessageFor(model => model.Category)
            </div>
        </div>
        <div class="field">
            <div class="editor-label">
                @Html.LabelFor(model => model.ActAt)
                <span>如：2012-12-28</span>
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.ActAt, new { @class = "datepicker" })
                @Html.ValidationMessageFor(model => model.ActAt)
            </div>
        </div>
        <div class="field">
            <div class="editor-label">
                @Html.LabelFor(model => model.Locale)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Locale)
                @Html.ValidationMessageFor(model => model.Locale)
            </div>
        </div>
        <div class="field">
            <div class="editor-label">
                @Html.LabelFor(model => model.Audience)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Audience)
                @Html.ValidationMessageFor(model => model.Audience)
            </div>
        </div>
        <div class="field">
            <div class="editor-label">
                @Html.LabelFor(model => model.Charge)
                <span>请填写金额</span>
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Charge)
                @Html.ValidationMessageFor(model => model.Charge)
            </div>
        </div>
        <div class="field field-large">
            <div class="editor-label">
                @Html.LabelFor(model => model.Description)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(model => model.Description)
                @Html.ValidationMessageFor(model => model.Description)
            </div>
        </div>
        <div class="field field-large">
            <div class="editor-label">
                @Html.LabelFor(model => model.Remark)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(model => model.Remark)
                @Html.ValidationMessageFor(model => model.Remark)
            </div>
        </div>
        <div class="field action">
            <div class="editor-label">
            </div>
            <div class="editor-field">
                <input type="submit" value="提交" />
            </div>
        </div>
        @{
            Html.EndForm();
        }
    </div>
</section>
